/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cinemasystem.app.modules.makepayment_avela.Impl;

import com.cinemasystem.model.MovieTechnology;
import com.cinemasystem.app.modules.makepayment_avela.MovieTechnologyPriceService;
import com.cinemasystem.services.crud.MovieTechnologyCrudService;
import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author spheshie
 */
public class MovieTechnologyPriceServiceImpl implements MovieTechnologyPriceService{
    private ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:com/cinemasystem/app/conf/applicationContext-*.xml");
;
    private MovieTechnologyCrudService movieTechnologyCrudService;
    
    @Override
    public MovieTechnology getMovieTechnologyObject(String movieTechnology, String status) {
        movieTechnologyCrudService = (MovieTechnologyCrudService) ctx.getBean("movieTechnologyCrudService");
        
        List<MovieTechnology> list = movieTechnologyCrudService.findAll();
        for(MovieTechnology mt: list){            
            if(movieTechnology.equals(mt.getMovieTechnology()) && status.equals(mt.getStatus())){
                return mt;
            }
        }
        return null;
    }
    
}
